home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
cool
/
ge_cool.lha
/
GE_COOL2.1
/
src
/
Association
/
TODO
< prev
Wrap
Text File
|
1992-04-13
|
856b
|
27 lines
file: Association.h
find
re-write this to not use reset next and key. find is heavily used,
and setting current position inside the loop (instead of using a local
variable in a register) slows it down
template <class Ktype, class Vtype>
Boolean Association<Ktype,Vtype>::find (const Ktype& key) {
for (long i = 0; i < this->number_elements; i++) // Search for key in list
if ((*this->compare_keys_s)(this->data[i].get_first(), key) == TRUE) {
this->current_position = i; // Set current position
return TRUE; // Return success
}
return FALSE; // Return failure
}
remove()
re-write to invoke the base class remove() method.
remove (const Ktype& key)
re-write to do a find(key) followed by remove()
put
put needs to call the general purpose protected grow method, that
Vector should have (see cool/Vector/TODO)